home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / Crossword / Source / filing.m < prev    next >
Text File  |  1995-06-12  |  980b  |  60 lines

  1. /*
  2.  
  3. File filing.m
  4.  
  5. The routines in this file fetch filenames using the application kit open and save panels.
  6.  
  7. */
  8.  
  9. #import <appkit/appkit.h>
  10. #import <strings.h>
  11.  
  12. #import "filing.h"
  13.  
  14.  
  15. /* ————————————————————————————————————————————————————————————————————————————  */
  16.  
  17.  
  18. static char        filename [200];
  19.  
  20.  
  21. /* ————————————————————————————————————————————————————————————————————————————  */
  22.  
  23.  
  24. const char *    fileForOpen (types)
  25.  
  26. char        ** types;
  27.  
  28. {
  29.     const char * const        * files;
  30.     const char                * directory;
  31.     id                        panel;
  32.  
  33.     if ([panel = [OpenPanel  new]  runModalForTypes: types])
  34.     {
  35.         files = [panel  filenames];
  36.         directory = [panel  directory];
  37.         strcpy(filename, directory);
  38.         strcat(filename, "/");
  39.         strcat(filename, files[0]);
  40.         
  41.         return filename;
  42.     }
  43.     
  44.     else return NULL;
  45. }
  46.  
  47.  
  48. const char *    fileForSave (type)
  49.  
  50. char        * type;
  51.  
  52. {
  53.     id        panel;
  54.     
  55.     panel = [[SavePanel  new]  setRequiredFileType: type];
  56.     if ([panel  runModal] == YES)
  57.     
  58.         return [panel  filename];        else
  59.         return NULL;
  60. }